<%@ LANGUAGE="VBSCRIPT" %>
<% option explicit%>
<% Response.Expires=0 %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%
dim Node, Tel
Node=request("Node")
if isEmpty(Node) then Node="_P"
Tel=request("Tel")
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<script>
function Reset2()
{
document.all["Form"].reset();
document.all["Tel"].value="";
}
</script>
</head>

<body bgcolor="#FBF3BB">
<!!%=request.querystring%>
<%
	Dim cnn
	Dim connStr
	dim cmd
	Set cnn=Server.CreateObject("ADODB.Connection")
        Set cmd=Server.CreateObject("ADODB.Command")
	connStr="Provider=SQLOLEDB.1;Persist Security Info=True;User ID=Test;Password=Test;Initial Catalog=SMS"&Node&";Data Source=(Local)"
	cnn.open connStr

	IF Request.querystring("Message")<>"" THEN
	Set cmd.ActiveConnection = cnn
	cmd.CommandText = "dbo.sp_setSMS @Phone='"&Request.querystring("Tel")&"',@Message='"&Request.querystring("Message")&"' "
	cmd.execute
	end IF

	IF Request.querystring("ClearTestResults")<>"" THEN
	Set cmd.ActiveConnection = cnn
	cmd.CommandText = "dbo.sp_ClearTestResults"
	cmd.execute
	end IF

	IF Request.querystring("Process")="Go" THEN
	Set cmd.ActiveConnection = cnn
	cmd.CommandText = "dbo.sp_ReleaseRMWProcessing"
	cmd.execute
	end IF

	IF Request.querystring("Process")="Stop" THEN
	Set cmd.ActiveConnection = cnn
	cmd.CommandText = "dbo.sp_StopRMWProcessing"
	cmd.execute
	end IF

	IF Request.querystring("CheckResults")<>"" THEN
	Set cmd.ActiveConnection = cnn
	cmd.CommandText = "dbo.sp_CheckTestResults @Application='PAY'"
	cmd.execute
	end IF


	set cmd=nothing
	set cnn=nothing


%>
<form action="a2.asp" metod=get id="Form">
<input name=Node type=hidden value="<%=Node%>">
<center>
<table border=1 cellpadding=2>
<tr>
<td> <b>+</b> 
<input id="Tel" name=Tel size=20 value="<%=Request("Tel")%>" >

</td>
<td colspan=9><input name=Message size=120></td>
</tr><tr>
<td align="center"><input type=submit value="Send SMS"></td>
<td align="center"><input type=reset value="Reset"></td>
<td align=center><input type=submit name="CheckResults" value="Check results" ></td>
<td align=center><input type=submit name="ClearTestResults" value="Clear Test Results"></td>

<td align=center><button onclick="CheckReview();" ID=Review><font color=red>Stop review</font></button></TD>
<td align=center><button onclick="CheckProcessing();" ID=Process><font color=red>Stop processing</font></button></TD>
<td align="center"> <table height="16" width="16"><tr><td bgcolor="#95CD70" id="IP">&nbsp;</td></tr></table></td>
</tr></table>
</form>
</table>
</font>
<script>
function CheckReview() {
top.ReviewFlag=!top.ReviewFlag;
if (top.ReviewFlag)	document.all["Review"].innerHTML="<font color=red>Stop review</font>"	
else document.all["Review"].innerHTML="<font color=green>Start review</font>";
top.frames['Up'].location='a1.asp?Node=<%=Node%>&Tel=<%=Tel%>';
};

function CheckProcessing() {
top.ProcessFlag=!top.ProcessFlag;
if (top.ProcessFlag) {
				location='a2.asp?Node=<%=Node%>&Tel=<%=Tel%>&Process=Go';
				}
else 			{
				location='a2.asp?Node=<%=Node%>&Tel=<%=Tel%>&Process=Stop';
				}
};

if (top.ProcessFlag) {
						document.all["Process"].innerHTML="<font color=red>Stop processing</font>";
 						document.all["IP"].bgColor="#95CD70";
						}
else 				{
				document.all["Process"].innerHTML="<font color=green>Start processing</font>";
				document.all["IP"].bgColor="#f5574B";
					};
				
if (top.ReviewFlag) {
					document.all["Review"].innerHTML="<font color=red>Stop review</font>";
					}
else {
	document.all["Review"].innerHTML="<font color=green>Start review</font>";
	};

</script>
</body>
</html>
